package com.yzt.base.utils;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class StringUtils {

	@Autowired
	private PasswordEncoder passwordEncoder;

	private static PasswordEncoder encoder;

	@PostConstruct
	public void init() {
		StringUtils.encoder = passwordEncoder;
	}

	public static String encoder(String s) {
		return encoder.encode(s);
	}
	
	public static boolean isBlank(final CharSequence cs) {
		return org.apache.commons.lang3.StringUtils.isBlank(cs);
	}
	
	public static boolean isNotBlank(final CharSequence cs) {
		return org.apache.commons.lang3.StringUtils.isNotBlank(cs);
	}
	
	public static void main(String[] args) {
		PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
		System.out.println(passwordEncoder.encode("1"));
	}
}
